class TaskResult < ActiveRecord::Base
  belongs_to :task, :polymorphic => true
  has_one :webpage

  #status 0未处理, 1解析成功 2解析失败
  #task_detail_type 0采集列表 1店铺信用页

  require 'base64'
  
  def source=(page)
      webpage = Webpage.new if webpage.nil?
      webpage.source = Base64.encode64(page)
  end

  def source
    Base64.decode64(webpage.source) unless webpage.nil?
  end
end
